import getLink from '@/api/getLink.js';

export const goodsMore = {
  state: {
    goodsArr: [],
  },
  mutations: {
    setGoodsArr(state, payload) {
      state.goodsArr = payload;
    },
  },
  actions: {
    getGoodsArr({ commit }, url) {
      getLink(url).then(ok => {
        commit('setGoodsArr', ok.data);
      });
    },
  },
  getters: {
    sliceGoodsArr(state) {
      return state.goodsArr.slice(0, 10);
    },
  },
};
